:root {
  --primary-color: #5a67d8;
  --secondary-color: #718096;
  --success-color: #48bb78;
  --warning-color: #f6ad55;
  --danger-color: #f56565;
  --light-bg: #f7fafc;
  --dark-bg: #2d3748;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #1a2a6c, #2c3e50);
  height: 100vh;
  overflow: hidden;
  color: #333;
  display: flex;
  flex-direction: column;
}

/* 顶部导航 */
.app-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  background: var(--primary-color);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.app-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 8px;
}

.status-connected {
  background-color: var(--success-color);
}

.status-disconnected {
  background-color: var(--danger-color);
}

.status-connecting {
  background-color: var(--warning-color);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* 聊天内容区域 */
.chat-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: rgba(247, 250, 252, 0.95);
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--secondary-color);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.3;
}

.message-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  margin-bottom: 12px;
  position: relative;
  animation: fadeIn 0.3s ease-out;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  word-wrap: break-word;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-bubble.me {
  background: linear-gradient(135deg, #d1e7dd, #b8e0d2);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message-bubble.other {
  background: linear-gradient(135deg, #e2e3e5, #d1d5db);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.message-sender {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.message-time {
  font-size: 0.7rem;
  color: var(--secondary-color);
  text-align: right;
  margin-top: 5px;
}

.system-message {
  text-align: center;
  color: var(--secondary-color);
  font-size: 0.85rem;
  margin: 10px 0;
  padding: 5px;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

/* 聊天输入区域 */
.chat-input {
  display: flex;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border-color);
}

.message-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 25px;
  font-size: 1rem;
  background: white;
}

.btn-send {
  background: var(--primary-color);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 设置面板 */
.settings-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  height: 100%;
  background: white;
  z-index: 1000;
  transition: right 0.3s ease;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-panel.active {
  right: 0;
}

.settings-header {
  background: linear-gradient(135deg, var(--primary-color), #4c51bf);
  color: white;
  padding: 20px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-title {
  font-size: 1.3rem;
  font-weight: 600;
}

.close-settings {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 15px;
}

.settings-section {
  margin-bottom: 25px;
}

.settings-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--dark-bg);
}

.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark-bg);
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
}

.btn-action {
  background: linear-gradient(135deg, var(--primary-color), #4c51bf);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-weight: 500;
  width: 100%;
  margin: 10px 0;
  font-size: 1rem;
}

.log-panel {
  height: 200px;
  overflow-y: auto;
  background: #2d3748;
  color: #e2e8f0;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  padding: 12px;
  border-radius: 8px;
  margin-top: 15px;
}

.log-entry {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.4;
}

.log-timestamp {
  color: #a0aec0;
  margin-right: 8px;
}

.log-info {
  color: #63b3ed;
}

.log-success {
  color: #68d391;
}

.log-warning {
  color: #f6e05e;
}

.log-error {
  color: #fc8181;
}

/* 覆盖层 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.overlay.active {
  display: block;
}

/* 用户列表 */
.user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.user-badge {
  padding: 6px 12px;
  background: #edf2f7;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-color);
}

/* 响应式调整 */
@media (max-width: 360px) {
  .app-header {
    padding: 12px;
  }
  
  .logo-icon {
    width: 35px;
    height: 35px;
  }
  
  .app-title {
    font-size: 1rem;
  }
  
  .message-input {
    padding: 10px 12px;
  }
}